<template>
  <el-table :data="props.data">
    <el-table-column show-overflow-tooltip width="140" prop="name" label="项目名称" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="year" label="年度" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="adminName" label="负责人" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="departmentName" label="办学单位" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="contactName" label="项目联系人姓名" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="contactPhone" label="项目联系人电话" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="startDate" label="开始时间" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="endDate" label="结束时间" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="establishType" label="办学方式" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="establishAddress" label="办学地点" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="charge" label="收费标准" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="tuitionFee" label="学费总额" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="trainingNum" label="培训人数" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="cooperation" label="合作方" align="center" />
    <!-- <el-table-column show-overflow-tooltip width="140" prop="classHours" label="总课时数" align="center" />
    <el-table-column show-overflow-tooltip width="140" prop="content" label="培训主要内容" align="center" /> -->
    <el-table-column show-overflow-tooltip width="140" prop="note" label="备注" align="center" />
    <el-table-column fixed="right" label="操作" width="220" align="center">
      <template #default="scope">
        <el-button
          v-if="hasAnthority('project.update')"
          type="primary"
          text
          bg
          size="small"
          @click="handleUpdate(scope.row)"
          >修改</el-button
        >
        <el-button
          v-if="hasAnthority('project.delete')"
          type="danger"
          text
          bg
          size="small"
          @click="handleDelete(scope.row)"
          >删除</el-button
        >
      </template>
    </el-table-column>
  </el-table>
</template>

<script setup lang="ts">
import { IGetProjectResponseData } from "@/api/project/types/project"
import { PropType } from "vue"
import { hasAnthority } from "@/utils"

const props = defineProps({
  data: {
    type: Array as PropType<IGetProjectResponseData[]>
  }
})
const emits = defineEmits(["update", "delete"])
const handleUpdate = (row: IGetProjectResponseData) => {
  emits("update", row)
}

const handleDelete = (row: IGetProjectResponseData) => {
  emits("delete", row)
}
</script>

<style scoped></style>
